package com.bbx.flink.demo.data_stream_state.keyed_state;


import com.bbx.flink.demo.data_stream_state.functions.MapStateDemo;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 监测传感器温度值，两个连续温度超过5 输出报警信息
 *
 */
public class SensorTemp {

    public static void main(String [] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.socketTextStream("192.168.10.131",10003)
                .map(i->Integer.parseInt(i))
                .keyBy(i->i%2==0)
                .flatMap(new MapStateDemo())
                .print();

        env.execute();



    }



}
